package com.sfac.hqyj.springBoot.modules.common.controller;

import com.sfac.hqyj.springBoot.modules.common.entity.ExceptionLog;
import com.sfac.hqyj.springBoot.modules.common.entity.ResultEntity;
import com.sfac.hqyj.springBoot.modules.common.service.ExceptionLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class ExceptionLogController {
    @Autowired
    private ExceptionLogService exceptionLogService;

    /**
     * 127.0.0.1/api/exceptionLog ---- post
     * {"ip":"127.0.0.1", "path":"/users", "className":"ExceptionLogController",
     * "methodName":"insertExceptionLog", "exceptionType":"Null",
     * "exceptionMessage":"balabala"}
     */
    @PostMapping(value = "/exceptionLog", consumes = "application/json")
    public ResultEntity<ExceptionLog> insertExceptionLog(
            @RequestBody ExceptionLog exceptionLog) {
        return exceptionLogService.insertExceptionLog(exceptionLog);
    }
}
